package com.home.biz;

import com.github.pagehelper.PageHelper;
import com.home.base.biz.BaseBiz;
import com.home.entity.JobUser;
import com.home.mapper.JobUserMapper;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.Date;
import java.util.List;

/**
 * @author ：chenxf
 * @date ：Created in 2019/6/19 10:26
 * @description：
 * @modified By：
 * @version: $
 */
@Service
public class JobUserBiz extends BaseBiz<JobUserMapper, JobUser> {
    /**

     * @param limit  条数
     * @param offset  页码
     * @return
     */
    public List<JobUser> list(int limit, int offset){
        PageHelper.startPage(offset, limit);
        Example example = new Example(JobUser.class);
        example.setOrderByClause(" depart_time desc");
        return selectByExample(example);

    }


    public List<JobUser> corroctUsers(Date startDate,Date endDate){
        PageHelper.startPage(0, 1);
        Example example = new Example(JobUser.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("status","0");
        criteria.andGreaterThanOrEqualTo("departTime",startDate);
        criteria.andLessThanOrEqualTo("departTime",endDate);
        example.setOrderByClause(" depart_time asc");
        return selectByExample(example);

    }
}
